package org.example3;


import org.example2.CustomerInvocationHandler;

import java.lang.reflect.Method;
import java.lang.reflect.UndeclaredThrowableException;

/**
 *  手写源码$Proxy
 */
public class $Proxy implements org.example2.IPerson {
    CustomerInvocationHandler h;

    public $Proxy(CustomerInvocationHandler h) {
        this.h = h;
    }

    public void findLove() {
        try {
            Method m = org.example2.IPerson.class.getMethod("findLove", new Class[]{});
            System.out.println("h is "+h);
            System.out.println("this is "+this);
            System.out.println("m is "+m);
            this.h.invoke(this, m, new Object[]{});
        } catch (Error _ex) {
        } catch (Throwable e) {
            throw new UndeclaredThrowableException(e);
        }
    }

    public java.lang.String introduceMyself(java.lang.String string, java.lang.Integer integer) {
        try {
            Method m = org.example2.IPerson.class.getMethod("introduceMyself", new Class[]{java.lang.String.class, java.lang.Integer.class});
            return (java.lang.String) this.h.invoke(this, m, new Object[]{string, integer});
        } catch (Error _ex) {
        } catch (Throwable e) {
            throw new UndeclaredThrowableException(e);
        }
        return null;
    }
}
